//
//  ObjectProperty.h
//  Template
//
//  Created by 陈德军 on 2017/4/18.
//  Copyright © 2017年 ChenDJ. All rights reserved.
//

#ifndef ObjectProperty_h
#define ObjectProperty_h


#pragma 常用颜色值
#define KK_MailColor [UIColor colorWithRed:0.01 green:0.68 blue:0.95 alpha:1.00]

#pragma 常用字体大小
#define KK_FONT18                  [UIFont systemFontOfSize:18.0f]

#pragma 常用图片名称

//设置RGB颜色/设置RGBA颜色
#define KK_RGBAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(r)/255.0 blue:(r)/255.0 alpha:a]

// clear背景颜色
#define KK_ClearColor [UIColor clearColor]

//高效率的 NSLog
#ifdef DEBUG
#define KK_Log(...) NSLog(@"%s 第%d行 \n %@\n\n",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])
#else
#define KK_Log(...)
#endif

//弱引用/强引用
#define KK_WeakSelf(type)  __weak typeof(type) weak##type = type;
#define KK_StrongSelf(type)  __strong typeof(type) type = weak##type;

//判断是否为iPhone
#define KK_IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
//判断是否为iPad
#define KK_IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
//判断是否为ipod
#define KK_IS_IPOD ([[[UIDevice currentDevice] model] isEqualToString:@"iPod touch"])

// 判断是否为 iPhone 5SE
#define KK_iPhone5SE [[UIScreen mainScreen] bounds].size.width == 320.0f && [[UIScreen mainScreen] bounds].size.height == 568.0f
// 判断是否为iPhone 6/6s
#define KK_iPhone6_6s [[UIScreen mainScreen] bounds].size.width == 375.0f && [[UIScreen mainScreen] bounds].size.height == 667.0f
// 判断是否为iPhone Plus/sPlus
#define KK_iPhone6Plus_6sPlus [[UIScreen mainScreen] bounds].size.width == 414.0f && [[UIScreen mainScreen] bounds].size.height == 736.0f

//获取系统版本
#define KK_IOS_SYSTEM_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
//判断 iOS 8 或更高的系统版本
#define KK_IOS_VERSION_8_OR_LATER (([[[UIDevice currentDevice] systemVersion] floatValue] >=8.0)? (YES):(NO))


//获取UIImage
#define KK_IImageFor(imageName) [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]

// 单例格式
#define singleton_interface(className) \
+ (className *)shared##className;

#define singleton_implementation(className) \
static className *_instance; \
+ (id)allocWithZone:(NSZone *)zone \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instance = [super allocWithZone:zone]; \
}); \
return _instance; \
} \
+ (className *)shared##className \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instance = [[self alloc] init]; \
}); \
return _instance; \
}

#define WeakSelf __weak typeof(self) weakSelf = self;

#endif /* ObjectProperty_h */
